import request from '@/utils/request';
// 登录方法
export const login = async (data) => {
  try {
    const response = await request(({
      url: '/login',
      headers: {
        isToken: false,
        repeatSubmit: false
      },
      method: 'post',
      data: data
    }));
    return response; // 返回登录响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 获取学生信息
export const getStudentInfo = async (data) => {
  try {
    const response = await request.get('/student/confirm/info', data);
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 确认学生入学
export const confirm = async (data) => {
  try {
    const response = await request.post('/student/confirm/confirm', data);
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 获取专业下拉
export const getMajorList = async (data) => {
  try {
    const response = await request.get('/system/major/selectList', data);
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 查询分班结果
export const getClazzResult = async (data) => {
  try {
    const response = await request.get('/student/confirm/clazzResult', data);
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 下载报道卡
export const download = async (data) => {
  try {
    const response = await request(({
      url: '/student/confirm/reportCard/download',
      method: 'get',
      responseType: 'blob',
      headers: {
        'Accept': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // 指定期望的文件类型
        'Content-Type': 'multipart/form-data'
      },
      data: data
    }));
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};
// 查询分班时间
export const getClazzDate = async (params) => {
  try {
    const response = await request.get('/student/confirm/ResultNotice', {params});
    return response; // 返回响应
  } catch (error) {
    throw error; // 抛出错误
  }
};